-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync prefs redo issue 6504 #3988
Conversation
c6832bc
to
9cda93a
Compare
Steps to check the issue in different situation I. Check how works reset with
II. Check how works reset over pressing cross near
III. Check how works
IV. Check the original STR from brave/brave-browser#6504 becomes not applicable
V. Check this PR build works with from old version by STR at brave-browser#6504
VI. Check we send bookmarks as soon as sync is enabled even if there are one device in chain
This below will go to the a separate PR for issue https://github.com/brave/brave-browser/issues/3628Check how works reset with
|
Created an issue for UI changes: brave/brave-browser#6941 . |
Marked it ready for review to trigger the CI. |
9cda93a
to
5b3dbb1
Compare
rebased due to |
device_name, object_id, SyncRecord::Action::A_DELETE, device_id); | ||
base::PostDelayedTask( | ||
FROM_HERE, {content::BrowserThread::UI}, | ||
base::BindOnce(&BraveProfileSyncServiceImpl::OnResolvedPreferencesWrp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for? I thought FetchDevices will also trigger OnResolvedPreferences
after we send delete this device record and then we see this device get deleted, then we reset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the case when we want to reset the sync but internet connection is offline.
When the internet is offline, FetchDevices
will get empty result, and we will not be able to call ResetSyncInternal()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we can simplify it by making sure DELETE device record is sent by OnRecordsSent
and then we can call ResetSyncInternal()
without involving OnResolvedPreferences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This delayed task doesn't really solve this situation
IV. Check how works reset with Leave Sync Chain button when the device is offline
1. Create sync chain of 2 devices, deviceA and deviceB
2. Turn off the internet connection on deviceA
3. Press Leave Sync Chain button on deviceA
4. Ensure chain have been reset on deviceA, but there deviceB still have deviceA in list
5. Close browser deviceA; turn on the internet conenction, launch browser of deviceA - ensure there are no sync chain on deviceA
device B still doesn't get delete record from A
Here are what we can do
- If we want to make sure device B gets DELETE A record, we need to block A from Reset until device A sends the record (which means device A get online)
- Or we can leverage
OnRecordsSent
as I mentioned in https://github.com/brave/brave-core/pull/3988/files#r348770951
It will get called no matter success or failure, then we callResetSyncInternal()
(failure will have empty records)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the case when internet connection is off there could not be a perfect solution, because we cannot send device DELETE record.
The option with delayed task gives two good points:
- If internet connection is on, then the device is able to send DELETE record, so it informs all other. No disadvantages here.
- If internet connection is off, then the device is able to make a proper self-reset. The only disadvantage is - other devices would not be informed and could see
zobmie
.
Any block of ourselves until get device DELETE record confirmation, makes sync to be under pending reset
for an unknown time.
As for now, when the internet connection is off, sending DEVICE delete record will never reach to AWS, because we do resend for bookmarks only.
We can leverage OnRecordsSent
and do there a cancellation of delayed task if we see device DELETE with our device_id. @darkdh what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don’t need delayed task if we use OnRecordsSent because when offline or any failed to send, it will get called with EMPTY records to indicate failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per Slack discussion, the case of reset when the device is offline will be done as separate issue (brave/brave-browser#3628) + separate PR after this PR will be merged.
50f7596
to
6f8b187
Compare
@darkdh addressed all comments, could you please look again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some UI issues like
- Right after sync chain is created, copy sync code/scan QR code dialog dismiss immediately and I have to click
in order to add second device - copy sync code/scan QR code can not be dismissed when there is only one device in sync chain( only achievable by close the tab or refresh the brave://sync), otherwise, it leads to Reset
Both can be addressed by brave/brave-browser#6941 (comment)
device_name, object_id, SyncRecord::Action::A_DELETE, device_id); | ||
base::PostDelayedTask( | ||
FROM_HERE, {content::BrowserThread::UI}, | ||
base::BindOnce(&BraveProfileSyncServiceImpl::OnResolvedPreferencesWrp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This delayed task doesn't really solve this situation
IV. Check how works reset with Leave Sync Chain button when the device is offline
1. Create sync chain of 2 devices, deviceA and deviceB
2. Turn off the internet connection on deviceA
3. Press Leave Sync Chain button on deviceA
4. Ensure chain have been reset on deviceA, but there deviceB still have deviceA in list
5. Close browser deviceA; turn on the internet conenction, launch browser of deviceA - ensure there are no sync chain on deviceA
device B still doesn't get delete record from A
Here are what we can do
- If we want to make sure device B gets DELETE A record, we need to block A from Reset until device A sends the record (which means device A get online)
- Or we can leverage
OnRecordsSent
as I mentioned in https://github.com/brave/brave-core/pull/3988/files#r348770951
It will get called no matter success or failure, then we callResetSyncInternal()
(failure will have empty records)
16f6653
to
209f9ce
Compare
Squashed all fix-meaning commits |
209f9ce
to
00ba1bd
Compare
CI failed with two errors:
and an unclear at
both are not related with PR, doing last attempt rebase. |
Allow one device to be in chain. Remove unnecessary states.
00ba1bd
to
47c29b6
Compare
CI failed with only error
for |
@AlexeyBarabash should this PR be in |
@kjozwiak yes, it should be in |
Fixes brave/brave-browser#6504
Submitter Checklist:
Seeing not related with PR fails at:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Please see the next message
Reviewer Checklist:
After-merge Checklist:
changes has landed on.